package chpt08;

import java.io.ByteArrayInputStream;

public class ByteArrayInputStreamTest {

	public static void main(String[] args) {
		String str ="Hello Java I/O Stream!";
		byte[] buf = str.getBytes();
		ByteArrayInputStream in = new ByteArrayInputStream(buf);
		int c;
		for(int i=0;i<5;i++) {
			c = in.read();
			if (c!=-1) System.out.print((char)c);
		}
		System.out.println();
		System.out.println("Bytes available:"+in.available());
		in.skip(10);
		while((c=in.read())!=-1) {
			System.out.print((char)c);
		}
	}
}
